home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 126-150 / disk_146 / dmemacros / commentedmacros / c.switch.edrc < prev    next >
Text File  |  1992-05-06  |  2KB  |  44 lines

  1. # insert lines for body of text; write marker in text to save location;
  2. # move cursor up one line (may have to add a line if at the top) and move
  3. # to the first character in the line (if there are no characters in the
  4. # line, the cursor moves to the leftmost column;
  5.  
  6. repeat 4 insline `+'  up  firstnb
  7.  
  8.  
  9. # if there is text on this line, insert a line between this line and the
  10. # first line of the template (unless the character is a left brace, in
  11. # which case I treat the line as being blank for appearance's sake
  12.  
  13. if c>32 `if c<>123 `down insline'' down
  14.  
  15.  
  16. # go down to end of template and insure that there is at least one blank
  17. # line between it and any text below it;
  18.  
  19. repeat 4 down firstnb
  20.  
  21. if c>32 insline
  22.  
  23.  
  24. # move back to marker and delete it;
  25.  
  26. repeat 4 up   firstnb del
  27.  
  28.  
  29. # write the body of the template; write a marker for later search & replace
  30. # needed to complete comment with branching expression; place cursor in
  31. # position to write between parentheses in branching expression;
  32.  
  33. `switch ()'         firstnb down
  34. `{'                 firstnb down down
  35. `} /* switch + */'  findstr `)'  prev
  36.  
  37. # prompt for the branching expression (it will printed as a string at the
  38. # cursor location; goto first character of the expression and read text into
  39. # the variable $scanf until you get to a right parenthesis (will not stop at
  40. # blanks); replace the marker in the comment with the text in $scanf; move
  41. # to blank line between braces and indent for entry of next line of code;
  42.  
  43. escimm (`)    first find `(' right while c<=32 right    scanf %[~)] down    findr `+' $scanf    firstnb up tab
  44.